array = list(map(int,input().split()))
for i in range(0,9,3):
    matrix = []
    matrix.extend(array[i:i+3])
    matrix.append(max(array[i:i+3]))
    matrix.append(sum(array[i:i+3]))
    print("".join("%4s"%i for i in matrix))